package com.chuanjiabao.wisdom.util.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;

import com.chuanjiabao.wisdom.R;
import com.chuanjiabao.wisdom.databinding.DialogShareFamilyFullBinding;
import com.chuanjiabao.wisdom.listener.OnBHClickListener;
import com.flyco.dialog.widget.base.BaseDialog;
import com.fzq.cameralib.util.ScreenUtils;

/**
 * 人员添加成功分享给本人
 */
public class ShareFamilyFullDialog extends BaseDialog {

    Context context;
    DialogShareFamilyFullBinding binding ;
    OnBHClickListener onBHClickListener;

    public ShareFamilyFullDialog(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public View onCreateView() {
        binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_share_family_full,null,false);
        binding.setDialog(this);
        return binding.getRoot();
    }

    @Override
    public void setUiBeforShow() {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.height = ScreenUtils.getScreenHeight(context); //设置宽度
        lp.width = ScreenUtils.getScreenWidth(context);   //设置宽度
        getWindow().setAttributes(lp);

        Animation rotateAnimation = AnimationUtils.loadAnimation(context, R.anim.rotate_anim);
        rotateAnimation.setInterpolator(new LinearInterpolator());
        binding.ivModuleBg.startAnimation(rotateAnimation);

        Animation topAnimation = AnimationUtils.loadAnimation(context, R.anim.share_down_in);
        topAnimation.setInterpolator(new LinearInterpolator());
        binding.flModuleTop.startAnimation(topAnimation);

        Animation bottomAnimation = AnimationUtils.loadAnimation(context, R.anim.share_up_in);
        bottomAnimation.setInterpolator(new LinearInterpolator());
        binding.llModuleBottom.startAnimation(bottomAnimation);
    }

    public void setOnBHClickListener(OnBHClickListener onBHClickListener) {
        this.onBHClickListener = onBHClickListener;
    }

    public void noPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onCloseClick();
        }
        dismiss();
    }

    public void okPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onConfirmClick();
        }
        dismiss();
    }

}


